<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="static/css/index.css">
</head>
<body>
<input type="button" value="新增" id="add"><br>
<hr>
<div class="table">
    <table border="1">
        <caption>
            图书管理系统
        </caption>
        <tr>
            <th>编号</th>
            <th>书名</th>
            <th>作者</th>
            <th>状态</th>
            <th>价格</th>
            <th>操作</th>
        </tr>

        <c:forEach items="${libraries}" var="library" varStatus="status">
            <tr align="center">
                <td>${library.bookId}</td>
                <td>${library.bookName}</td>
                <td>${library.bookAuthor}</td>
                <c:if test="${library.bookStutas == 1}">
                    <td>启用</td>
                </c:if>

                <c:if test="${library.bookStutas != 1}">
                    <td>禁用</td>
                </c:if>

                <td>${library.bookPrice}</td>
                <td><a href="/library/SelectByIdServlet?id=${library.bookId}">修改</a> <a href="/library/DeleteByIdServlet?id=${library.bookId}">删除</a></td>
            </tr>
        </c:forEach>

    </table>
</div>
</body>
<script>
    document.getElementById('add').onclick = function (){
        location.href="/library/add.jsp";
    }
</script>
</html>
